package com.efast.cafe.portal.security.handler;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.security.authentication.AuthenticationServiceException;
import org.springframework.security.core.AuthenticationException;
import org.springframework.security.web.authentication.AuthenticationFailureHandler;
import org.springframework.stereotype.Component;

import com.efast.cafe.framework.exception.ServiceException;
import com.efast.cafe.portal.security.core.AuthenticationFactory;

import net.sf.json.JSONObject;
/**
 * 
    * @ClassName: MyLoginFailureHandler
    * @Description: 自定义的登录失败Handler 返回json
    * @author xuanming.feng
    * @date 2018年8月3日
    *
 */
@Component
public class MyLoginFailureHandler implements AuthenticationFailureHandler{

	@Override
	public void onAuthenticationFailure(HttpServletRequest request, HttpServletResponse response,
			AuthenticationException exception) throws IOException, ServletException {
		AuthenticationFactory.onAuthenticationFailure(request, response, exception);
	}

}
